package com.zsrt.java.day20170102.lh.collegesorequerysystem;


import java.util.List;

import org.junit.Test;

public class CollegeTest {
	
	@Test
	public void addTest() throws Exception {
		CollegeList xt=new CollegeList();
		List<User> userList = xt.getUserList();
		
		User u=new User();
		u.setCardNum("1001");
		u.setName("小明");
		u.setCity("茂名");
		u.setAge(18);
		u.setRole("学生");
		u.setChineseScore(225);
		u.setMathScore(150);
		u.setEnglishScore(140);
		u.setProvince("广东");
		
		
		User u1=new User();
		u1.setCardNum("1002");
		u1.setName("小宏");
		u1.setAge(18);
		u1.setRole("学生");
		u1.setCity("茂名");
		u1.setChineseScore(225);
		u1.setMathScore(145);
		u1.setEnglishScore(160);
		u1.setProvince("广东");
		
		
		User u2=new User();
		u2.setCardNum("1003");
		u2.setName("小蓝");
		u2.setCity("茂名");
		u2.setAge(18);
		u2.setRole("学生");
		u2.setChineseScore(235);
		u2.setMathScore(145);
		u2.setEnglishScore(145);
		u2.setProvince("北京");
		
		//添加方法
		xt.add(u);
		xt.add(u1);
		xt.add(u2);
		
		System.out.println("====================添加===");
		for (User user : userList) {
			System.out.println(user);
		}
		
		System.out.println("====================修改===");
		//修改的方法
		Boolean f = xt.update("小", "广东", "茂名");
		if(f){
			for (User user : userList) {
				System.out.println(user);
			}
		}else{
			System.out.println("没有这个人，修改失败");
		}
		
		
		
		
		/*System.out.println("====================删除===");
		
		Boolean fa = xt.delete("1003");
		if(fa){
			for (User user : userList) {
				System.out.println(user);
			}
		}else{
			System.out.println("没有这个人，删除失败");
		}*/
		
		System.out.println("====================关键字城市查找===");
		List<User> fList = xt.findBykeyWord(1,"茂名");
		for (User user : fList) {
			System.out.println(user);
		}
		
		
		System.out.println("====================关键字名字查找===");
		List<User> fList1 = xt.findBykeyWord(2,"小宏");
		for (User user : fList1) {
			System.out.println(user);
		}
		
		System.out.println("====================关键字准考证查找===");
		List<User> fList2 = xt.findBykeyWord(3,"1001");
		for (User user : fList2) {
			System.out.println(user);
		}
		
		System.out.println("====================查看个人自己的信息===");
		xt.seeOneself("10021");
		
		System.out.println("====================查看登陆当前总分状元===");
		
		User cityTop1 = xt.cityTop1("1001");
		System.out.println(cityTop1);
		
		System.out.println("====================查看每个省的状元===");
		xt.provinceTop();
		System.out.println("====================打印每省500到600的考生===");
		xt.statistics(1);
		
		
		
	}
	
	
	
	

}
